package com.three.lab.page.common;


import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.three.lab.R;
import com.three.lab.base.BaseActivity;
import com.three.lab.util.ToastUtils;
import com.three.lab.widget.ProgressBar.NumberProgressBar;
import com.three.lab.widget.ProgressBar.OnProgressBarListener;

import java.util.Timer;
import java.util.TimerTask;

public class AboutUsActivity extends BaseActivity {

    private TextView textView,tvTitle;
    private Timer timer;

    private NumberProgressBar bnp;

    @Override
    protected void initParms(Bundle bundle) {}

    @Override
    protected int bindLayout() {
        return R.layout.activity_about_us;
    }

    @Override
    protected void initViews(View view, Bundle savedInstanceState) {
        tvTitle = $(R.id.tv_title);
        tvTitle.setText(R.string.about_us);
        textView = $(R.id.tv_content);

        bnp = $(R.id.numberbar1);
        bnp.setOnProgressBarListener(new OnProgressBarListener() {
            @Override
            public void onProgressChange(int current, int max) {
                if(current == max) {
                    ToastUtils.showToast("完成");
                    bnp.setProgress(0);
                }

            }
        });
        timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        bnp.incrementProgressBy(1);
                    }
                });
            }
        }, 1000, 100);

    }

    @Override
    protected void setListener() {
        $(R.id.iv_left).setOnClickListener(this);
    }

    @Override
    protected void widgetClick(View v) {
        switch (v.getId()){
            case R.id.iv_left:
                finish();
                break;
        }
    }

    @Override
    protected void initData(Context mContext) {

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        timer.cancel();
    }
}